package com.maixy.studyonlineapi.utils;

import java.util.Arrays;

/**
 * redis key工具
 * Created by jason on 17-3-29.
 */
public class RedisKeyUtil {

    public static String build(String baseKey, Object... keys) {
        return baseKey.concat(":")
                .concat(Arrays.toString(keys))
                .replace("[", "")
                .replace("]", "")
                .replace(",", ":")
                .replace(" ", "");
    }

    public static String buildV2(String baseKey, Object... keys) {
        return baseKey.concat("_")
                .concat(Arrays.toString(keys))
                .replace("[", "")
                .replace("]", "")
                .replace(",", "_")
                .replace(" ", "");
    }
}
